VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.1#0"; "MSCOMCTL.OCX"
Begin VB.MDIForm menu 
   BackColor       =   &H00FFFFFF&
   Caption         =   "CENTRO DE AGUAS Y SANEAMINETO AMBIENTAL"
   ClientHeight    =   6360
   ClientLeft      =   192
   ClientTop       =   816
   ClientWidth     =   9384
   LinkTopic       =   "MDIForm1"
   StartUpPosition =   3  'Windows Default
   WindowState     =   2  'Maximized
   Begin MSComDlg.CommonDialog cdialog 
      Left            =   120
      Top             =   720
      _ExtentX        =   847
      _ExtentY        =   847
      _Version        =   393216
   End
   Begin VB.PictureBox barraBaja 
      Align           =   2  'Align Bottom
      BeginProperty Font 
         Name            =   "Verdana"
         Size            =   9
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   0
      ScaleHeight     =   324
      ScaleWidth      =   9336
      TabIndex        =   0
      Top             =   5988
      Width           =   9384
   End
   Begin MSComctlLib.Toolbar menu_toolbar 
      Align           =   1  'Align Top
      Height          =   288
      Left            =   0
      TabIndex        =   1
      Top             =   0
      Width           =   9384
      _ExtentX        =   16552
      _ExtentY        =   508
      ButtonWidth     =   487
      ButtonHeight    =   466
      Appearance      =   1
      Style           =   1
      ImageList       =   "imlToolbarIcons"
      HotImageList    =   "imlToolbarIcons"
      _Version        =   393216
      BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
         NumButtons      =   12
         BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Key             =   "ac"
            Object.ToolTipText     =   "Aguas de Consumo"
            ImageKey        =   "ac"
         EndProperty
         BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Key             =   "r1"
            Object.ToolTipText     =   "Residuos Industriales Liq."
            ImageKey        =   "r1"
         EndProperty
         BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Key             =   "r2"
            Object.ToolTipText     =   "Residuos Domesticos Liq."
            ImageKey        =   "r2"
         EndProperty
         BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Key             =   "sep"
            Style           =   3
         EndProperty
         BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Key             =   "fisi"
            ImageKey        =   "fisi"
         EndProperty
         BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Key             =   "sep1"
            Style           =   3
         EndProperty
         BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Key             =   "guardar"
            Object.ToolTipText     =   "Guardar"
            ImageKey        =   "guardar"
         EndProperty
         BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Key             =   "imprimir"
            Object.ToolTipText     =   "Imprimir"
            ImageKey        =   "imprimir"
         EndProperty
         BeginProperty Button9 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Style           =   3
         EndProperty
         BeginProperty Button10 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Enabled         =   0   'False
            Object.Visible         =   0   'False
            Key             =   "ayuda"
            Object.ToolTipText     =   "Ayuda"
            ImageKey        =   "ayuda"
         EndProperty
         BeginProperty Button11 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Key             =   "salir"
            Object.ToolTipText     =   "Salir"
            ImageKey        =   "salir"
         EndProperty
         BeginProperty Button12 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Key             =   "nuevo"
            Object.ToolTipText     =   "Informe"
            ImageKey        =   "nuevo"
         EndProperty
      EndProperty
   End
   Begin MSComctlLib.ImageList imlToolbarIcons 
      Left            =   0
      Top             =   0
      _ExtentX        =   995
      _ExtentY        =   995
      BackColor       =   -2147483643
      ImageWidth      =   16
      ImageHeight     =   16
      MaskColor       =   12632256
      _Version        =   393216
      BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
         NumListImages   =   10
         BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "menu1.frx":0000
            Key             =   "nuevo"
         EndProperty
         BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "menu1.frx":1D0C
            Key             =   "ac"
         EndProperty
         BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "menu1.frx":6C7C
            Key             =   "abrir"
         EndProperty
         BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "menu1.frx":CF18
            Key             =   "guardar"
         EndProperty
         BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "menu1.frx":D7F4
            Key             =   "imprimir"
         EndProperty
         BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "menu1.frx":13418
            Key             =   "salir"
         EndProperty
         BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "menu1.frx":1386C
            Key             =   "ayuda"
         EndProperty
         BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "menu1.frx":13E08
            Key             =   "r1"
         EndProperty
         BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "menu1.frx":18FB4
            Key             =   "r2"
         EndProperty
         BeginProperty ListImage10 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "menu1.frx":1EDC4
            Key             =   "fisi"
         EndProperty
      EndProperty
   End
   Begin MSComctlLib.ImageList ImageList1 
      Left            =   1320
      Top             =   1320
      _ExtentX        =   995
      _ExtentY        =   995
      BackColor       =   -2147483643
      ImageWidth      =   13
      ImageHeight     =   13
      MaskColor       =   12632256
      _Version        =   393216
      BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
         NumListImages   =   9
         BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "menu1.frx":249D8
            Key             =   ""
         EndProperty
         BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "menu1.frx":24CFC
            Key             =   "user"
         EndProperty
         BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "menu1.frx":251C5
            Key             =   ""
         EndProperty
         BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "menu1.frx":254F4
            Key             =   ""
         EndProperty
         BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "menu1.frx":25845
            Key             =   ""
         EndProperty
         BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "menu1.frx":25B67
            Key             =   ""
         EndProperty
         BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "menu1.frx":25EAA
            Key             =   ""
         EndProperty
         BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "menu1.frx":261C5
            Key             =   ""
         EndProperty
         BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "menu1.frx":26506
            Key             =   ""
         EndProperty
      EndProperty
   End
   Begin VB.Menu form_princi 
      Caption         =   "Formularios"
      Index           =   0
      Begin VB.Menu subnuevoac 
         Caption         =   "&Aguas de Consumo"
      End
      Begin VB.Menu subnuevoAn 
         Caption         =   "&Agua Natural"
      End
      Begin VB.Menu subnuevoril 
         Caption         =   "&Residuos Industriales Liq."
      End
      Begin VB.Menu subnuevordl 
         Caption         =   "Residuos &Domesticos Liq."
      End
      Begin VB.Menu raya1 
         Caption         =   "-"
      End
      Begin VB.Menu subsalir 
         Caption         =   "Salir"
         Index           =   5
      End
   End
   Begin VB.Menu modificar 
      Caption         =   "Modificar"
      Visible         =   0   'False
   End
   Begin VB.Menu menuanalisis 
      Caption         =   "Analisis"
      Begin VB.Menu subfisico 
         Caption         =   "Fisicoquimico"
         Begin VB.Menu subFnuevo 
            Caption         =   "Nuevo"
         End
         Begin VB.Menu subFM 
            Caption         =   "Modificar"
         End
      End
      Begin VB.Menu submicro 
         Caption         =   "Microbiologico"
         Begin VB.Menu subNM 
            Caption         =   "Nuevo"
         End
         Begin VB.Menu subMM 
            Caption         =   "Modificar"
         End
      End
   End
   Begin VB.Menu submenurep 
      Caption         =   "Reportes"
      Begin VB.Menu subllenar 
         Caption         =   "Llenar"
         Begin VB.Menu subllfisi 
            Caption         =   "Fisicoquimico"
         End
         Begin VB.Menu sublleMi 
            Caption         =   "Microbiologico"
         End
      End
      Begin VB.Menu subResidual 
         Caption         =   "Modificar"
         Begin VB.Menu subResFisi 
            Caption         =   "Fisiquimico"
         End
         Begin VB.Menu subResMicro 
            Caption         =   "Microbiologico"
         End
      End
   End
   Begin VB.Menu menudiagramas 
      Caption         =   "Diagramas"
      Begin VB.Menu subTickel 
         Caption         =   "Tickel"
      End
   End
   Begin VB.Menu menuestadisticos 
      Caption         =   "Cuadros Estadisticos"
   End
   Begin VB.Menu admin 
      Caption         =   "Administrador"
      Begin VB.Menu sublista 
         Caption         =   "Lista parametros"
      End
      Begin VB.Menu subusuario 
         Caption         =   "Usuario"
         Index           =   22
      End
      Begin VB.Menu subTCI 
         Caption         =   "Tipo de Cambio"
      End
      Begin VB.Menu raya 
         Caption         =   "-"
         Visible         =   0   'False
      End
      Begin VB.Menu subM 
         Caption         =   "Modificar"
         Visible         =   0   'False
      End
      Begin VB.Menu subElim 
         Caption         =   "Eliminar"
         Visible         =   0   'False
      End
   End
   Begin VB.Menu menuayuda 
      Caption         =   "Ayuda"
      Enabled         =   0   'False
   End
End
Attribute VB_Name = "menu"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Public VBWord As Word.Application


'*****************************************************
' Finalidad: Menu de la barra principal
'*****************************************************
Private Sub subnuevoac_Click()
bandProtocolo = 0: ac.Show
End Sub
Private Sub subnuevoAn_Click()
an.Show
End Sub
Private Sub subnuevoril_Click()
ril.Show
End Sub
Private Sub subnuevordl_Click()
rdl.Show
End Sub
Private Sub subsalir_Click(Index As Integer)
End
End Sub
'Private Sub modificar_Click()
'modificar_form.Show
'End Sub
Private Sub subFnuevo_Click()
Dim aux As String
aux = devolverCont("count(*)", "parametros WHERE ensayo='fi' and valores=''", 0)
If CInt(aux) <> 0 Then
bandEnsayo = 1: fisicoquimico.Show 'Nuevo
Else
Call mensajes(8)
End If
End Sub
Private Sub subFM_Click()
Dim aux As String
aux = devolverCont("count(*)", " parametros WHERE ensayo='fi' and valores<>''", 0)
If CInt(aux) <> 0 Then
bandEnsayo = 2: fisicoquimico.Show 'Modificar
Else
Call mensajes(8)
End If
End Sub
Private Sub subNM_Click()
Dim aux As String
aux = devolverCont(" count(*)", " parametros WHERE ensayo='mi' and valores=''", 0)
If CInt(aux) <> 0 Then
bandEnsayo = 1: microbiologico.Show 'nuevo
Else
Call mensajes(8)
End If
End Sub
Private Sub subMM_Click()
Dim aux As String
aux = devolverCont(" count(*)", " parametros WHERE ensayo='mi' and valores<>''", 0)
If CInt(aux) <> 0 Then
bandEnsayo = 2: microbiologico.Show 'Modificar
Else
Call mensajes(8)
End If
End Sub
'*****************************************************
' Finalidad: Menu de la barra principal Reportes
'*****************************************************
'Private Sub subllfisi_Click()
'bandReporte = 1: rep_fisico.Show 'reportes fisicoquimico
'End Sub

'/*/*////////////////////////////////////////////
Private Sub subllfisi_Click()
'nuevo fisico
bandModi = 1: bandReporte = 1: rep_fisico.Show
If bandReporte = 0 Then Unload rep_fisico
End Sub
'Modificar
Private Sub subResFisi_Click()
bandModi = 2: bandReporte = 1: rep_fisico.Show
If bandReporte = 0 Then Unload rep_fisico

End Sub
Private Sub sublleMi_Click()
'nuevo micro
bandModi = 1: bandReporte = 1: rep_micro.Show
If bandReporte = 0 Then Unload rep_micro
End Sub
Private Sub subResMicro_Click()
'modificar micro
bandModi = 2: bandReporte = 1: rep_micro.Show
If bandReporte = 0 Then Unload rep_micro
End Sub
'////////////////////////////////////////
'BASICO
Private Sub subRNFisi_Click()
'nuevo fisico
bandModi = 1: bandReporte = 1: rep_fisico.Show
If bandReporte = 0 Then Unload rep_fisico
End Sub
Private Sub subRMfi_Click()
'modifi fisico
bandModi = 2: bandReporte = 1: rep_fisico.Show
If bandReporte = 0 Then Unload rep_fisico
End Sub
Private Sub subBnuevo_Click()
'nuevo micro
bandModi = 1: bandReporte = 1: rep_micro.Show
If bandReporte = 0 Then Unload rep_micro
End Sub
Private Sub subBMo_Click()
'modifi micro
bandModi = 2: bandReporte = 1: rep_micro.Show
If bandReporte = 0 Then Unload rep_micro
End Sub
'residual
Private Sub subResNueFi_Click()
'nuevo fisico
bandModi = 1: bandReporte = 2: rep_fisico.Show
If bandReporte = 0 Then Unload rep_fisico
End Sub
Private Sub subResMo_Click()
'modifi fisi
bandModi = 2: bandReporte = 2: rep_fisico.Show
If bandReporte = 0 Then Unload rep_fisico
End Sub
Private Sub subResNmicro_Click()
'nuevo micro
bandModi = 1: bandReporte = 2: rep_micro.Show
If bandReporte = 0 Then Unload rep_micro
End Sub
Private Sub subResMoMicro_Click()
'modifi micro
bandModi = 2: bandReporte = 2: rep_micro.Show
If bandReporte = 0 Then Unload rep_micro
End Sub
'riego
Private Sub subrieNue_Click()
'nuevo fisico
bandModi = 1: bandReporte = 3:
rep_fisico.Show
If bandReporte = 0 Then Unload rep_fisico
End Sub
Private Sub subRieModi_Click()
'modifi fisico
bandModi = 2: bandReporte = 3: rep_fisico.Show
If bandReporte = 0 Then Unload rep_fisico
End Sub
'hormigon
Private Sub subHnue_Click()
'nuevo fisico
bandModi = 1: bandReporte = 4: rep_fisico.Show
If bandReporte = 0 Then Unload rep_fisico
End Sub
Private Sub subHmodi_Click()
'modifi fisico
bandModi = 2: bandReporte = 4: rep_fisico.Show
If bandReporte = 0 Then Unload rep_fisico
End Sub
Private Sub modificar_Click()
Dim result As String
Dim Dir1 As String, aux As String
Dim labo As String

aux = nombreform
For Each colecForms In Forms
 If colecForms.Name = aux Then 'Si es el mismo nombre del form
 Set nombForm = colecForms 'Asignarlo a la variable
 End If
Next

'aux = revisarDecimales(",56")
'cadParametros = "12345-SC-1364/2-4-1-2-1-6-7-8"
'''cadParametros = "12345-SC-1364/2-4-1-2-1-6-7-8*21089-SC-18657/1-2-3-4-5-6-7-8"
'''datosTickel.Show

'labo = nombForm.txt_reg1.Text & "-" & nombForm.txt_reg2.Text & "-" & nombForm.txt_reg3.Text
'Dir1 = "c:\tesis_informatica\croquis\" & aux & "\" '"d:\PROYECTO_CASA\software\casa\v1.3\croquis\" & aux & "\"
'Call copiar_renombrarArch(imagen, Dir1, "labo")

'///////////**/*/***/*/*/*/*/*/*
'Dim Documento As Word.Document
'Call generarPDF("hola")

   'con datareport
    'Call imprimir(7, 1, 0)
    'Call imprimir(CInt(aux3), 1, 0) 'tbasico,fisico
    'Call plantillas(7, 1, 0, "menu")
Call crearplantilla(1, 1, 0, "menu")

    'Call crearplantillaMicro(8, 2, 1, "menu")
    'word
    'Call ImpReporte(CInt(aux3), 1, 0)
    'Set VBWord = New Word.Application 'Nuevo instancia del objeto
    'Agrega un Nuevo documento de word
    'Set Documento = VBWord.Documents.Add
    'Call macroDatos(7, 1, 0, "menu")
    'menu.VBWord.Visible = True 'Hago visible el word
    'Set VBWord = Nothing
    'Set Documento = Nothing
    'Exit Sub
    'ErrSub:
    'MsgBox Err.Description
    'On Error Resume Next
    'Set VBWord = Nothing
    'Set Documento = Nothing
End Sub

'*****************************************************
' Finalidad: GRAFICOS de la barra principal
'*****************************************************
Private Sub subTickel_Click()
buscar.Show
End Sub
'*****************************************************
' Finalidad: ESTADISTICAS de la barra principal
'*****************************************************
Private Sub menuestadisticos_Click()
Dim aux As String
aux = devolverCont("count(*)", " protocolo", 0)
If CInt(aux) <> 0 Then
 estadistica.Show
Else
Call mensajes(8)
End If
End Sub
'*****************************************************
' Finalidad: ADMINISTRADOR de la barra principal
'*****************************************************
'%%%%%%%%%%% LISTA PARAMETROS
'Private Sub subcompleto_Click()
'bandReporte = 3 'TODOS LOS PARAMETROS
'listParam.Show
'End Sub
'Private Sub lisfisico_Click()
'bandReporte = 1 'FISICO
'listParam.Show
'End Sub
'Private Sub lisMicro_Click()
'bandReporte = 2 'MICROBIOLOGICO
'listParam.Show
'End Sub

'Private Sub sublista_Click() 'lista de los parametros existentes
'listParam.Show
'End Sub
Private Sub sublista_Click()
bandReporte = 3 'TODOS LOS PARAMETROS
listParam.Show
End Sub
Private Sub subusuario_Click(Index As Integer) 'INSERTAR USUARIO
' usuarios.Show
 band = 1: lista.Show
End Sub
Private Sub subPI_Click() 'INSERTAR PARAMETROS
'costosParam.txt_cambio.Text = tipoCambio()
costosParam.Show
End Sub
Private Sub subTCI_Click() 'TIPO DE CAMBIO
'tipo_Cambio.Show
band = 2: lista.Show
End Sub
Private Sub subM_Click() 'MODIFICAR COSTO
modi_costo.Show
End Sub
Private Sub subElim_Click() 'ELIMINAR
  'Call datosReporte
  'DataReport2.Show
End Sub
'*****************************************************
' Finalidad: AYUDA de la barra principal
'*****************************************************
'*****************************************************
' Finalidad: BARRA DE HERRAMIENTAS
'*****************************************************
Private Sub menu_toolbar_ButtonClick(ByVal Button As MSComctlLib.Button)
 Select Case Button.Key
 Case "ac"
  ac.Show
 Case "r1"
  ril.Show
 Case "r2"
  rdl.Show
 Case "guardar"
  Call guardar_tool_click
 Case "imprimir"
 Case "fisi" 'NUEVO ENSAYO FISICOQUIMICO
  bandEnsayo = 1: Call subFnuevo_Click
 Case "salir"
 
  End
 Case "nuevo"
 End Select
 'menu_toolbar.Left = 0
 'menu_toolbar.Width = 11400
End Sub
'*****************************************************
' Finalidad: FUNCION GUARDAR LOS FORMULARIOS
'*****************************************************
Private Sub guardar_tool_click()
Dim cont As Long, r As Long, i As Long
Dim cad As String, mensaje As String
Dim aux As String, aux3 As String, bandProtocolo As Integer
Dim explode() As String, param As String
Dim j As Long
'variables para los archivos
Dim Dir1 As String
Dim labo As String


'## BUSCAR FORM
 For Each colecForms In Forms
 If colecForms.Name = nombreform Then 'Si es el mismo nombre del form
    Set nombForm = colecForms 'Asignarlo a la variable
 End If
Next
'crear directorios y copy and rename archivos


'INSERTAR Y MODIFICAR PROTOCOLOS
bandProtocolo = 0

Select Case nombreform

Case Is = "ac", Is = "an", Is = "rdl", Is = "ril"

labo = nombForm.txt_reg1.Text & "-" & nombForm.txt_reg2.Text & "-" & nombForm.txt_reg3.Text
'Dir1 = "d:\PROYECTO_CASA\software\casa\v1.3\croquis\" & nombreform & "\"
Dir1 = "c:\tesis_informatica\croquis\" & nombreform & "\"

 Select Case bandProtocolo
 Case Is = 0 'Nuevo
  If pregObligatorias(nombreform) = 1 Then
  'Call insertProtocolo(nombreform)
   aux = insertProtocolo(nombreform)
   If imagen <> "" Then
   Call copiar_renombrarArch(imagen, Dir1, labo)
   End If
   If aux = 1 Then
   aux3 = mensajes(5) 'se ingreso satisfactoriamente
   Unload Me 'cierro
   Select Case nombreform
   Case Is = "ril": ril.Show
   Case Is = "rdl": rdl.Show
   Case Is = "an": an.Show
   Case Is = "ac": nombForm.Show 'abro
   End Select
   End If
  End If
 Case Is = 1 'modificar
 End Select
 
'*** ENSAYO
Case Is = "fisicoquimico"

  r = nombForm.flex_analisis.Rows
  For i = 0 To r - 1
  aux3 = nombForm.flex_analisis.TextMatrix(i, 0)
  If aux3 = "OTROS" Then cad = nombForm.flex_analisis.TextMatrix(i, 2)
  Next i
  aux = UpdateEnsayo(1, cad, nombForm.cmb_reg.Text, nombForm.cmb_muestra.Text, r - 1)
  If aux = 1 Then
   aux3 = mensajes(5) 'se ingreso satisfactoriamente
   Unload Me 'cierro
   nombForm.Show 'abro
  Else
  cad = mensajes(6) 'se ingreso incorrectamente
  End If
  
Case Is = "microbiologico"

 r = nombForm.flex_analisis.Rows
 aux = devolverCod("cod_protocolo as cod", "protocolo", "nro_reg='" & nombForm.cmb_reg.Text & "'", 0)
 If nombForm.cmb_pat <> "Ape. Paterno" And nombForm.cmb_mat <> "Ape. Materno" And nombForm.cmb_nomb <> "Nombre(s)" Then
 aux3 = codPersonal(nombForm.cmb_pat & "-" & nombForm.cmb_mat & "-" & nombForm.cmb_nomb, "")
 Else
 aux3 = 0
 End If
 'modifica la fecha
 cad = UpdateFech(aux, nombForm.dtp_fanalisis.Year & "-" & nombForm.dtp_fanalisis.Month & "-" & nombForm.dtp_fanalisis.Day, colocarNum(nombForm.dtp_Hensayo.Hour) & ":" & colocarNum(nombForm.dtp_Hensayo.Minute), aux3)
 'modificar parametros
 param = devolverCod("parametro as cod", "parametros", "ensayo='mi' and cod_protocolo='" & aux & "'", 0)
 explode = Split(param, "-")
 For i = LBound(explode) To UBound(explode)
  If i = 0 Then
  param = devolverCod("parametro as cod", "costos_quimicos", "cod_costos=" & explode(i) & "", 0)
  Else
  param = param & "-" & devolverCod("parametro as cod", "costos_quimicos", "cod_costos=" & explode(i) & "", 0)
  End If
 Next i
 aux = cad: cad = ""
 explode = Split(param, "-")
 For j = LBound(explode) To UBound(explode)
  For i = 1 To r - 1
   If microbiologico.flex_analisis.TextMatrix(i, 0) = explode(j) Then
   param = microbiologico.flex_analisis.TextMatrix(i, 3)
   End If
  aux3 = nombForm.flex_analisis.TextMatrix(i, 0)
  If aux3 = "CONCLUSIONES" Then aux3 = nombForm.flex_analisis.TextMatrix(i, 3)
  
  Next i
  If j = 0 Then
  cad = param
  Else
  cad = cad & "-" & param
  End If
 Next j
 cad = cad & "*" & aux3
 If aux = 1 Then
  aux3 = UpdateEnsayo(2, cad, nombForm.cmb_reg.Text, nombForm.cmb_muestra.Text, r - 1)
  If aux3 = 1 Then
   cad = mensajes(5) 'se ingreso satisfactoriamente
   Unload Me 'cierro
   nombForm.Show 'abro
  End If
 Else
  cad = mensajes(6) 'se ingreso incorrectamente
 End If
'** REPORTES
Case Is = "rep_fisico"

 If nombForm.check_reuneCondi.Value = 1 Then aux = nombForm.check_reuneCondi.Caption
 If nombForm.Check_noReune.Value = 1 Then aux = nombForm.Check_noReune.Caption
 If nombForm.check_cliente.Value = 1 Then aux = nombForm.check_cliente.Caption
 cad = devolverCod("cod_protocolo as cod", "protocolo", "nro_reg='" & nombForm.cmb_reg.Text & "'", 0)
aux3 = updateReporte(1, cad, rep_fisico.txt_resultado.Text, rep_fisico.txt_conclusion.Text, rep_fisico.txt_recomendacion.Text, aux)
If aux3 = 1 Then
 cad = mensajes(5) 'se ingreso satisfactoriamente
 aux3 = devolverCod("cod_protocolo as cod", "protocolo", "nro_reg='" & nombForm.cmb_reg.Text & "'", 0)
 Unload Me 'cierro
 '******ESCRIBIR EN WORD ***
 'Call crearplantilla(7, 1, 0, "menu")
 'que parametros mostrara
 'tipoPlantilla (aux3)
 Call crearplantilla(CInt(aux3), 1, 0, "menu")
 'Call imprimir(CInt(aux3), 1, 0) 'tbasico,fisico
 '***************************
 nombForm.Show 'abro
 If bandReporte = 0 Then Unload rep_fisico
Else
cad = mensajes(6) 'se ingreso incorrectamente
End If

Case Is = "rep_micro"

 If nombForm.check_reuneCondi.Value = 1 Then aux = nombForm.check_reuneCondi.Caption
 If nombForm.Check_noReune.Value = 1 Then aux = nombForm.Check_noReune.Caption
 If nombForm.check_cliente.Value = 1 Then aux = nombForm.check_cliente.Caption
 param = devolverCod("cod_protocolo as cod", "protocolo", "nro_reg='" & nombForm.cmb_reg.Text & "'", 0)
 aux3 = updateReporte(2, param, rep_micro.txt_resultado.Text, rep_micro.txt_conclusion.Text, rep_micro.txt_recomendacion.Text, aux) ' devolverCod("cod_protocolo as cod", "protocolo", "nro_reg='" & nombForm.cmb_reg.Text & "'", 0)
If aux3 = 1 Then
 cad = mensajes(5) 'se ingreso satisfactoriamente
 aux3 = devolverCod("cod_protocolo as cod", "protocolo", "nro_reg='" & nombForm.cmb_reg.Text & "'", 0)
 Unload Me 'cierro
 '/** WORD
 Call crearplantillaMicro(CInt(aux3), 1, 0, "menu")
 '/**
 nombForm.Show 'abro
 If bandReporte = 0 Then Unload rep_micro
Else
cad = mensajes(6) 'se ingreso incorrectamente
End If
'lbl_sar
'lbl_clase
'======= %%%%%%%%%%%%%%%%%%%%%%
'========  ADMINISTRADOR
Case Is = "tipo_Cambio"
aux3 = "'" & nombForm.dtp_tipoCambio.Year & "-" & nombForm.dtp_tipoCambio.Month & "-" & nombForm.dtp_tipoCambio.Day & "'"
aux = "'','" & nombForm.txtT_cambio.Text & "','" & UCase(nombForm.txt_referencia.Text) & "'," & aux3
If nombForm.txtT_cambio.Text <> "" Then
Call insertAdd("tipo_cambio", aux)
Unload nombForm
nombForm.Show
Else
 Call mensajes1(1, " de tipo de cambio")
 nombForm.txtT_cambio.SetFocus
End If
'========= USUARIOS
Case Is = "usuarios"
If usuarios.cmb_nivel.ListIndex = 0 Then
i = 1
Else
i = 2
End If
aux = "'','" & nombForm.txt_cargo.Text & "','" & nombForm.txt_login.Text & "','" & nombForm.txt_pass.Text & "','',''," & i & ",'" & nombForm.txt_nomb.Text & "','" & nombForm.txt_paterno.Text & "'"
If nombForm.txt_cargo.Text <> "" And nombForm.txt_login.Text <> "" And nombForm.txt_pass.Text <> "" Then
Call insertAdd("administrador", aux)
Unload nombForm
nombForm.Show
Else
 Call mensajes1(1, "")
 If nombForm.txt_cargo.Text = "" And nombForm.txt_login.Text = "" And nombForm.txt_pass.Text = "" Then
  nombForm.txt_cargo.SetFocus
 ElseIf nombForm.txt_cargo.Text <> "" And nombForm.txt_login.Text = "" And nombForm.txt_pass.Text = "" Then
 nombForm.txt_login.SetFocus
 ElseIf nombForm.txt_cargo.Text <> "" And nombForm.txt_login.Text <> "" And nombForm.txt_pass.Text = "" Then
 nombForm.txt_pass.SetFocus
 End If
End If
'===== INGRESAR PARAMETROS
Case Is = "costosParam"
If nombForm.chek_basico.Value = 0 Then
aux3 = "N"
Else
aux3 = "B"
End If
If nombForm.cmb_anali.ListIndex = 0 Then
param = "fi"
ElseIf nombForm.cmb_anali.ListIndex = 1 Then
param = "mi"
End If
If nombForm.cmbEn.ListIndex = 0 Then
aux = "bacte"
ElseIf nombForm.cmbEn.ListIndex = 1 Then
aux = "parasi"
ElseIf nombForm.cmbEn.ListIndex = 2 Then
aux = "viral"
ElseIf nombForm.cmbEn.ListIndex = 3 Then
aux = "otros"
End If
If param = "fi" Then aux = "n"
aux = "'','" & nombForm.txt1.Text & "','" & nombForm.txt3.Text & "','" & nombForm.txt5.Text & "','" & nombForm.txt6.Text & "','" & nombForm.txt7.Text & "','" & nombForm.txt4.Text & "','" & aux3 & "','" & param & "','" & nombForm.txt9.Text & "','" & aux & "',0,'" & nombForm.txt2.Text & "','" & nombForm.txt8.Text & "','" & nombForm.txt10.Text & "','" & nombForm.txt11.Text & "','" & nombForm.txt12.Text & "'"
If nombForm.txt1.Text <> "" Then 'parametro
Call insertAdd("costos_quimicos", aux)
Unload nombForm
nombForm.Show
End If

End Select
End Sub

